<?php
namespace app\modules\admin\controllers;
use yii\web\Controller;
use app\components\SadminController;
use Yii;
use app\components\admin_menu;
use yii\helpers\Url;

class ConfigController extends SadminController {

    public $layout = 'main';

    
    public function actionIndex(){
        
    }
    
       public function actionSet_base(){
           
          $this->get_menu()->set_now(admin_menu::M_set, admin_menu::M_set_base);
     
         $con =  new \app\models\config\SiteForm;     
         $con->load(Yii::$app->request->post())&&$con->save()&&$this->save_refresh();
       return $this->render('set_base', array(
            'model' => $con
        ));
    }
    
  

        public function actionM_set_seo(){      ///actionM_set_seo
         
         $this->get_menu()->set_now(admin_menu::M_set, admin_menu::M_seo);
     
         $con = new \app\models\config\SeoForm; 
        $con->load(Yii::$app->request->post())&&$con->save()&&$this->save_refresh();
     
           
        
        return $this->render('m_set_seo', array(
            'model' => $con
        ));
    }


   
    public function actionUp_pass(){
  
        //$us=new \app\commands\User();
        
    //    var_dump(Yii::$app->user->isGuest);   exit;
        $this->get_menu()->set_now(admin_menu::M_set,  admin_menu::M_pass); 
        $model=new \app\models\config\UserForm();
        
        if($model->load(Yii::$app->request->post())&&$model->save()){
            Yii::$app->session->addFlash('save');
            $this->save_refresh();return;
        } 

        
        return $this->render('password',['model'=>$model]);
    }
    
  
       public function actionUpfile(){          
     $this->get_menu()->set_now(admin_menu::M_set,admin_menu::M_upfile);         
      return (new \app\modules\admin\models\ViewUpfile)
        ->get_html($this,['style'=>'margin: 22px;']); 
 }

    public function actionT(){
      
         $model = new  \app\models\ContactForm();
       return $this->render('t',['model'=>$model]);
    }
    
    
}
